begintalkscript;

variables;

begintalknode 1;
	state = -1;
	nextstate = 1;
	question = "Wihcaser";
	text1 = "Wihcaser is standing patiently at his guardpost.  He smiles as you approach, but something seems different.";
	text2 = "_Greetings, brothers in arms!  'Tis a fine day._  He begins fiddling with his fingers.  Is something bothering him?";
	text3 = "_Well...  I have a wild idea!  Do you want to hear it?_";
	text4 = "This is strange.  Wihcaser treats his duty with the utmost respect at all times, and has never been the one to suggest wild ideas.";
	text5 = "Wihcaser is still standing here anxiously, waiting for you to respond somehow.";
	action = INTRO;

begintalknode 2;
	state = 1;
	nextstate = 2;
	question = "What wild idea do you have?";
	text1 = "He points to the gate with his sword and smiles uneasily.  _We could go inside to guard._";
	text2 = "_The sun is warm, but the cave is cool.  We could spare ourselves workless sweat and go inside._";
	text3 = "Something sounds fishy.  Why would he even suggest such a notion?";

begintalknode 3;
	state = 2;
	nextstate = 3;
	question = "What made you think of this?";
	text1 = "_Oh, nothing, really!  I just figured that it would be more pleasant inside._";
	text2 = "_We could practice sword and spear maneuvers inside, if you want.  I know you enjoy doing that._";
	text3 = "_Sparring is something guards aren't supposed to do, but ever since we were children, it was entertaining to practice our skills._";
	text4 = "He puts both hands on his waist and pushes his chest out.  _Why not?  Or are you afraid that I'll beat you?_";

begintalknode 4;
	state = 3;
	nextstate = -1;
	question = "Well, if you put it that way...";
	text1 = "Wihcaser has NEVER suggested such entertaining notions since ten years ago, when he was only barely twenty years of age.";
	text2 = "What has gotten into him, you have no idea.  Nevertheless, it is a good change to be certain!";
	text3 = "Wihcaser opens the gate and joins your group.  _Come now, let's go inside!_";
	text4 = "(Wihcaser has joined the party.)";
	action = END_TALK;
	code = 
		set_flag(2,1,2);
		add_char_to_party(7);
		set_terrain(20,22,32);
	break;

begintalknode 10;
	state = -1;
	nextstate = 5;
	question = "Smid";
	text1 = "He takes a good look at your items, smiles, and folds his arms triumphantly.";
	text2 = "_Yes, I know what all of these are.  For a meager price of 3 gold each, I can tell you._";

begintalknode 11;
	state = 5;
	nextstate = -1;
	question = "Then identify our items, please.";
	text1 = "_No problem!  Three gold apiece isn't too much money, so I hope you won't have a problem paying._";
	action = ID 3;

begintalknode 15;
	state = -1;
	nextstate = 6;
	question = "Hapud";
	text1 = "This is Hapud, one of the Speres who stand guard at the post on the south end of town.  He's considerably lazier than his brothers-in-arms, which explains why he's slacking off in his room.";
	text2 = "_Greetings, brave Speres!  How are things going?_";
	text3 = "_Greetings, brave Spere!  How are things going?_";
	text4 = "_I'm just standing inside because, um...  I'm guarding the house.  Yeah._";
	text5 = "Hapud is still standing here, slacking off as usual.  He smiles and waves as you approach.";
	text6 = "_Can I help you in any way?_";
	action = INTRO;
	code = 
		if(party_size() > 1){
			remove_string(3);
		}
		else{
			remove_string(2);
		}
	break;

begintalknode 16;
	state = 6;
	nextstate = -1;
	question = "Things aren't going so well.";
	text1 = "_I know.  I heard about what happened with Wihcaser...  You have my deepest sympathies._";
	text2 = "You tell him that Wihcaser ran off, after having stolen the Aquos Gem.  He seems shocked.";
	text3 = "_You're...  You're joking, right?_  You don't say a word.";
	text4 = "_Oh, spirits help us all...  That's terrible.  I'm sincerely sorry about...  Wow.  You have my sympathies._";
	code = 
		if(get_flag(2,1) < 52 && get_flag(14,1) == 0){
			remove_string(1);
			set_flag(14,1,1);
		}
		else{
			remove_string(2);
			remove_string(3);
			remove_string(4);
		}
	break;

begintalknode 17;
	state = 6;
	nextstate = 7;
	condition = get_flag(2,1) >= 52;
	question = "Can you help us in any way on our quest?";
	text1 = "_Can I?  Of course I can!  I'm an expert fighter, you see, and if any one of you needs a crash course to review your skills, I'm your man!_";
	text2 = "_If you need any training, just let me know.  I may look lazy, but I'm an awesome teacher!_";
	text3 = "Somehow you doubt him, but...";

begintalknode 18;
	state = 7;
	nextstate = 6;
	question = "We'll pass, but thanks anyway.";
	text1 = "He shrugs.  _Don't mention it._";
	text2 = "_Just say the word if you want some help._";

begintalknode 19;
	state = 7;
	nextstate = -1;
	question = "We'll take you up on your offer.";
	text1 = "You conclude your business.";
	code = 
		begin_shop_mode("Hapud's Training","Hapud is lazy, but is surprisingly skilled.  While he can't teach you much besides the basics, his lessons could be potentially enlightening for those of you whose skills are lacking.",9,2,-1);
	break;

begintalknode 20;
	state = 6;
	nextstate = -1;
	question = "And you're guarding your house, why?";
	text1 = "_Simple!  So we don't get robbed._";
	text2 = "He's completely shameless.  This is not surprising.";

begintalknode 21;
	state = -1;
	nextstate = -1;
	question = "Geoguth";
	text1 = "The child here ignores you and continues staring into the brazier.";
	text2 = "Magos turns to you.  _That's my apprentice.  His name is Geoguth, and he's meditating as to speak with the spirits._";
	text3 = "_Leave him alone, please.  Thank you._";
	text5 = "Geoguth is still meditating here.  You do him a favor and let him be.";
	action = INTRO;

begintalknode 25;
	state = -1;
	nextstate = 8;
	question = "Spere";
	text1 = "The Spere here is standing guard, not really paying attention to you.  When on guard, Speres are supposed to remain still and not address anyone unless addressed.";

begintalknode 26;
	state = 8;
	nextstate = -1;
	question = "How are things going?";
	text1 = "The Spere shrugs.  _They're going okay.  No troubles recently._";
	text2 = "The Spere shakes his head.  _You should be on your holy mission, not wasting hime here.  Wihcaser the traitor could be anywhere._";
	text3 = "The Spere smiles.  _Things are going well, now that the Aquos Gem is back in the village.  Spirits be thanked!_";
	code = 
		if(get_flag(2,1) < 52){
			remove_string(2);
			remove_string(3);
		}
		if(get_flag(2,1) < 75 && get_flag(2,1) >= 52){
			remove_string(1);
			remove_string(3);
		}
		if(get_flag(2,1) >= 76){
			remove_string(1);
			remove_string(2);
		}
	break;